﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:dataInput="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data.Input" mc:Ignorable="d"
	x:Class="ThrowModal.MainPage"
	Width="570" Height="430">
    <UserControl.Resources>
        <Style TargetType="ToolTip">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <TextBlock TextWrapping="Wrap" Width="200" Text="{Binding}" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Storyboard x:Name="showDetails">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="image">
                <EasingDoubleKeyFrame KeyTime="0" Value="180"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="canvasDetails">
                <EasingDoubleKeyFrame KeyTime="0" Value="-330"/>
                <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="tbShowDetails">
                <DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="Hide details"/>
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
        <Storyboard x:Name="HideDetails">
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[2].(RotateTransform.Angle)" Storyboard.TargetName="image">
                <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="0:0:0.5" Value="180"/>
            </DoubleAnimationUsingKeyFrames>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="canvasDetails">
                <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                <SplineDoubleKeyFrame KeyTime="0:0:0.5" Value="-330"/>
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.Text)" Storyboard.TargetName="tbShowDetails">
                <DiscreteObjectKeyFrame KeyTime="0" Value="Hide details"/>
                <DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="Show details"/>
            </ObjectAnimationUsingKeyFrames>
        </Storyboard>
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="White">
        <Canvas x:Name="canvasDetails" Margin="0,95,0,8" RenderTransformOrigin="0.5,0.5">
            <Canvas.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform/>
                </TransformGroup>
            </Canvas.RenderTransform>
            <TextBlock x:Name="labelTitle" Height="18" TextWrapping="Wrap" Text="Title:" Width="50" Canvas.Left="8" Canvas.Top="17"/>
            <TextBox x:Name="tbTitle" Height="27" TextWrapping="Wrap" Text="Thow a Modal" Width="497" Canvas.Left="66" Canvas.Top="13" ToolTipService.ToolTip="A string that contains the title of the dialog."/>
            <TextBlock x:Name="labelHTML" Height="18" TextWrapping="Wrap" Width="50" Canvas.Left="8" Canvas.Top="80"><Run Text="HTML:"/><LineBreak/><Run/></TextBlock>
            <TextBox x:Name="tbHTML" TextWrapping="Wrap" Height="56" Canvas.Left="66" Canvas.Top="80" Width="497" KeyDown="tb_KeyDown">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="A string that contains the HTML of the page that appears in the dialog." />
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Margin="0,5,0,0" Text="If both html and url are specified, url takes precedence. Either url or html must be specified." />
                    </StackPanel>
                </ToolTipService.ToolTip>
            </TextBox>
            <TextBlock x:Name="labelY" Height="18" TextWrapping="Wrap" Canvas.Left="151" Canvas.Top="232" Width="50"><Run Text="Y"/><Run Text=":"/></TextBlock>
            <TextBlock x:Name="labelX" Height="18" TextWrapping="Wrap" Text="X:" Canvas.Left="8" Canvas.Top="232" Width="50"/>
            <TextBox x:Name="tbX" Height="27" TextWrapping="Wrap" Text="" Canvas.Left="66" Canvas.Top="228" Width="50" ToolTipService.ToolTip="An integer value that specifies the x-offset of the dialog. This value works like the CSS left value." KeyDown="tb_KeyDown"/>
            <TextBox x:Name="tbY" Height="27" TextWrapping="Wrap" Text="" Canvas.Left="201" Canvas.Top="228" Width="50" ToolTipService.ToolTip="An integer value that specifies the y-offset of the dialog. This value works like the CSS top value." KeyDown="tb_KeyDown"/>
            <TextBlock x:Name="labelCallBack" TextWrapping="Wrap" Height="18" Canvas.Left="8" Canvas.Top="149" Width="172"><Run Text="Dialog Return Value Callback"/><Run Text=":"/><LineBreak/><Run/><LineBreak/><Run/></TextBlock>
            <TextBox x:Name="tbCallback" TextWrapping="Wrap" Text="ThrowModalCallBack" Width="379" Height="27" Canvas.Left="184" Canvas.Top="145" IsReadOnly="True" >
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="A function pointer that specifies the return callback function. The function takes two parameters, a dialogResult of type SP.UI.DialogResult Enumeration and a returnValue of type object that contains any data returned by the dialog."/>
                    </StackPanel>
                </ToolTipService.ToolTip>
            </TextBox>
            <TextBlock x:Name="labelArgs" Height="18" TextWrapping="Wrap" Width="50" Canvas.Left="8" Canvas.Top="191"><Run Text="Args:"/><LineBreak/><Run/></TextBlock>
            <TextBox x:Name="tbArgs" Height="27" TextWrapping="Wrap" Width="497" Canvas.Left="66" Canvas.Top="187" ToolTipService.ToolTip="An object that contains data that are passed to the dialog." KeyDown="tb_KeyDown"/>
            <TextBlock x:Name="labelResult" TextWrapping="Wrap" Text="Callback Result Value:" Width="50" Height="56" Canvas.Left="8" Canvas.Top="268"/>
            <TextBox x:Name="tbResults" TextWrapping="Wrap" Height="56" Width="497" d:LayoutOverrides="Height" Canvas.Left="66" Canvas.Top="268" ToolTipService.ToolTip="The results passed back from the modal will be displayed here."/>
            <CheckBox x:Name="cbAllowMaximize" Content="Allow Maximize" Height="24" Width="114" VerticalAlignment="Top" Canvas.Left="66" Canvas.Top="53">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="A Boolean value that specifies whether the dialog can be maximized. true if the Maximize button is shown; otherwise, false."/>
                    </StackPanel>
                </ToolTipService.ToolTip>
            </CheckBox>
            <CheckBox x:Name="cbShowMaximized" Content="Show Maximized" Height="20" Width="130" VerticalAlignment="Top" Canvas.Left="211" Canvas.Top="53">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="A Boolean value that specifies whether the dialog opens in a maximized state. true the dialog opens maximized. Otherwise, the dialog is opened at the requested sized if specified; otherwise, the default size, if specified; otherwise, the autosized size."/>
                    </StackPanel>
                </ToolTipService.ToolTip>
            </CheckBox>
            <CheckBox x:Name="cbAutoSize" Content="Auto Size" Width="114" ToolTipService.ToolTip="A Boolean value that specifies whether the dialog platform handles dialog sizing." Height="24" VerticalAlignment="Top" Canvas.Left="358" Canvas.Top="53" Checked="cbAutoSize_Checked" Unchecked="cbAutoSize_Unchecked"/>
            <CheckBox x:Name="cbShowClose" Content="Show Close" Width="114" ToolTipService.ToolTip="A Boolean value that specifies whether the Close button appears on the dialog." Height="23" VerticalAlignment="Top" Canvas.Left="476" Canvas.Top="53"/>
            <Path Data="M8,0 L666.04865,0" Fill="#FFA3A3A3" Height="1" Canvas.Left="8" Stretch="Fill" Stroke="Black" UseLayoutRounding="False" Width="555" Canvas.Top="3"/>
        </Canvas>
        <Canvas x:Name="canvasSimple" Height="97" Margin="0,-2,0,0" VerticalAlignment="Top" Background="White">
            <TextBox x:Name="tbURL" Height="27" TextWrapping="Wrap" Text="/_layouts/settings.aspx" Canvas.Left="65" Canvas.Top="8" Width="449" KeyDown="tb_KeyDown">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="A string that contains the URL of the page that appears in the dialog. If both url and html are specified, url takes precedence. Either url or html must be specified." />
                    </StackPanel>
                </ToolTipService.ToolTip>
            </TextBox>
            <TextBlock Height="18" TextWrapping="Wrap" Text="URL:" Width="50" Canvas.Left="8" Canvas.Top="12"/>
            <Button x:Name="btnGo" Content="Go" Height="27" Width="45" Click="Button_Click" ToolTipService.ToolTip="Throw a Modal" Canvas.Left="518" Canvas.Top="8"/>
            <TextBox x:Name="tbWidth" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" Text="0" Width="36" RenderTransformOrigin="-0.088,0.667" Foreground="Gray" BorderThickness="0" KeyDown="tbWidth_KeyDown" Canvas.Left="268" Canvas.Top="41">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="An integer value that specifies the width of the dialog. If width is not specified, the width of the dialog is autosized by default. If autosize is false, the width of the dialog is set to 768 pixels." />
                    </StackPanel>
                </ToolTipService.ToolTip>
            </TextBox>
            <Slider x:Name="sliderWidth" Width="210" Minimum="25" Maximum="1400" SmallChange="10" Value="0" ValueChanged="sliderWidth_ValueChanged" Canvas.Left="62" Canvas.Top="44">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="An integer value that specifies the width of the dialog. If width is not specified, the width of the dialog is autosized by default. If autosize is false, the width of the dialog is set to 768 pixels." />
                    </StackPanel>
                </ToolTipService.ToolTip>
            </Slider>
            <TextBlock TextWrapping="Wrap" Text="Size:" Width="50" Height="18" Canvas.Left="8" Canvas.Top="44"/>
            <TextBox x:Name="tbHeight" Height="22" TextWrapping="Wrap" Text="0" Width="40" RenderTransformOrigin="-0.088,0.667" Foreground="Gray" BorderThickness="0" KeyDown="tbHeight_KeyDown" Canvas.Left="514" Canvas.Top="41">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="An integer value that specifies the height of the dialog. If height is not specified, the height of the dialog is autosized by default. If autosize is false, the dialog height is set to 576 pixels."/>
                    </StackPanel>
                </ToolTipService.ToolTip>
            </TextBox>
            <Slider x:Name="sliderHeight" HorizontalAlignment="Right" Width="210" Minimum="25" Maximum="1200" SmallChange="10" Value="0" ValueChanged="sliderHeight_ValueChanged" Canvas.Left="304" Canvas.Top="44">
                <ToolTipService.ToolTip>
                    <StackPanel Margin="0,5,0,5">
                        <TextBlock TextWrapping="Wrap" Width="Auto" MaxWidth="420" Text="An integer value that specifies the height of the dialog. If height is not specified, the height of the dialog is autosized by default. If autosize is false, the dialog height is set to 576 pixels."/>
                    </StackPanel>
                </ToolTipService.ToolTip>
            </Slider>
            <Image x:Name="image" Height="19" Width="19" Source="chevron_down.png" RenderTransformOrigin="0.5,0.5" Canvas.Left="8" Canvas.Top="73" Stretch="None">
                <Image.RenderTransform>
                    <TransformGroup>
                        <ScaleTransform/>
                        <SkewTransform/>
                        <RotateTransform/>
                        <TranslateTransform/>
                    </TransformGroup>
                </Image.RenderTransform>
            </Image>
            <TextBlock x:Name="tbShowDetails" TextWrapping="Wrap" Height="18" Width="177" Text="Show details" Canvas.Left="28" Canvas.Top="75"/>
            <Rectangle x:Name="butDetails" Fill="#FFF4F4F5" Height="34" Stroke="Black" Width="130" Opacity="0" MouseLeftButtonUp="butDetails_MouseLeftButtonUp" Canvas.Top="61"/>
        </Canvas>
    </Grid>
</UserControl>